﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using KBEngineTool.Core;
using KBEngine.Common;
using KBEngine;
using System.Windows.Forms;
using KBEngine.Setting.TypeDef;

namespace KBEngineTool
{
    class Operation : Singleton<Operation>
    {
        public bool IsOpenProj { get; private set; } = false;
        public IType CurrentSelectedType { get; internal set; }
        public KBEngine.clientapp ClientApp { get; private set; }
       
        protected override void Init()
        {
            ClientApp = new KBEngine.clientapp();
        }
        public bool OpenProject(string assetFolder)
        {
            if (!SlnConfig.Inst.Load(assetFolder))
                return false;
            ToolConfig.Inst.Load(SlnConfig.Inst.toolConfigFile);
            EntityDef.LoadFromFile(SlnConfig.Inst.entityDefFolder, SlnConfig.Inst.entitiesXML, SlnConfig.Inst.typesXML);
            IsOpenProj = true;
            return true;
        }
    }
}
